{51 () State in Haskell
نویسنده
چکیده
Some algorithms make critical internal use of updatable state, even though their external speciication is purely functional. Based on earlier work on monads, we present a way of securely encapsulating stateful computations that manipulate multiple, named, mutable objects, in the context of a non-strict, purely-functional language. The security of the encapsulation is assured by the type system, using parametricity. The same framework is also used to handle input/output operations (state changes on the external world) and calls to C.
منابع مشابه
Lazy Imperative Programming
In this paper we argue for the importance of lazy state, that is, sequences of imperative (destructive) actions in which the actions are delayed until their results are required. This enables state-based computations to take advantage of the control power of lazy evaluation. We provide some examples of its use, and describe an implementation within Glasgow Haskell.
متن کاملImplementing Recursive Algorithms within Hardware using Finite State Machines
This paper proposes a method of combining the concepts of recursive algorithms and functional programming in hardware design. Though recursion is readily available in functional programming languages, a translation step is required to convert the recursion in such functional program to a synthesizable hardware specification. This proposal uses the idea of Finite State Machines used in [5], comb...
متن کاملHiding State in CλaSH Hardware Descriptions
Synchronous hardware can be modelled as a mapping from input and state to output and a new state. Functions in this form are referred to as transition functions. It is natural to use a functional language to implement transition functions. The CλaSH compiler is capable of translating Haskell code written in this form to VHDL. Modelling hardware using multiple components is convenient. Component...
متن کاملParallelizing DPLL in Haskell
We report on a case study of implementing parallel variants of the DavisPutnam-Logemann-Loveland algorithm for solving the SAT problem of propositional formulas in the functional programming language Haskell. We explore several state of the art programming techniques for parallel and concurrent programming in Haskell and provide the corresponding implementations. Based on our experimental resul...
متن کاملAxiomatic Constructor Classes in Isabelle/HOLCF
We have definitionally extended Isabelle/HOLCF to support axiomatic Haskell-style constructor classes. We have subsequently defined the functor and monad classes, together with their laws, and implemented state and resumption monad transformers as generic constructor class instances. This is a step towards our goal of giving modular denotational semantics for concurrent lazy functional programm...
متن کامل